package org.openurp.edu.student.info.model

import org.beangle.data.model.bind.Mapping

/**
 * @author xinzhou
 */
class DefaultMapping extends Mapping {

  def binding(): Unit = {
    defaultIdGenerator("auto_increment")

    bind[Checkinstate].on(e => declare(
      e.code & e.name are notnull))

    bind[Exchange].on(e => declare(
      e.name is notnull))

    bind[Gender].on(e => declare(
      e.code & e.name & e.enname are notnull))

    bind[Paystate].on(e => declare(
      e.code & e.name & e.enname are notnull))

    bind[Paytype].on(e => declare(
      e.code & e.name & e.enname are notnull))

    bind[Scholarship].on(e => declare(
      e.code & e.name are notnull))

    bind[Schooling].on(e => declare(
      e.code & e.name are notnull))

    bind[Semester].on(e => declare(
      e.code & e.name & e.beginOn & e.endOn & e.schoolYear are notnull))

    bind[Stdtype].on(e => declare(
      e.code & e.name are notnull))

    bind[Stdtypes].on(e => declare(
      e.code & e.name are notnull))

    bind[Student].on(e => declare(
      e.passportNo & e.name are notnull))

    bind[StudentWai].on(e => declare(
      e.visas is depends("studentWai")))

    bind[Attachment].on(e => declare(
      e.updatedAt is notnull,
      e.name is (notnull, length(50)),
      e.fileSize is (notnull),
      e.path is (notnull, length(200))))

    bind[Visa].on(e => declare(
      e.semester & e.studentWai & e.updatedAt are notnull,
      e.name is (notnull, length(50)),
      e.fileSize is (notnull),
      e.path is (notnull, length(200))))

    bind[User].on(e => declare(
      e.code & e.username & e.password are notnull))

    bind[Userstate].on(e => declare(
      e.code is notnull,
      e.name is notnull))
  }
}
